<%@ page contentType="text/html;charset=UTF-8" isELIgnored="true" autoFlush="true"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/displaytag.tld" prefix="display" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="/WEB-INF/qautil.tld" prefix="qautil"%>
<span class="title1">共享资料分类</span>
<logic:present name="sfc">
    <c:set var="sfclist" value="${sfc.mrIaskSharedFileCategories}"/>
    <c:set var="sfcParentId" value="${sfc.mrIaskSharedFileCategory.id}"/>
    <logic:present name="sfcParentId">
    <html:link page="/sfc.mrqa?action=view" paramId="id" paramName="sfcParentId">返回</html:link>
    </logic:present>
    <table class="qlist">
        <html:form action="/sfc" method="post" onsubmit="return validate(this)">
        <html:hidden property="id"/>
        <html:hidden property="action" value="modify"/>
        <thead>
            <tr class="odd">
                <th colspan="2">修改共享资料分类信息</th>
            </tr>
        </thead>
        <tbody>
            <tr class="even">
                <td>ID</td>
                <td><bean:write name="sfc" property="id"/></td>    
            </tr>
            <tr class="odd">
                <td>名称</td>
                <td>
                    <html:text property="name" name="sfc"/>
                </td>
            </tr>
            <tr class="even">
                <td>层级</td>
                <td>
                    <c:out value="${sfc.level}"/>
                </td>
            </tr>
            <tr class="odd">
                <td>优先显示</td>
                <td>
                    <html:text property="priority" name="sfc"/>
                </td>
            </tr>
            <tr class="even">
                <td colspan="2" align="center" style="text-align:center">
                    <logic:notPresent name="sfcParentId">
                        <html:link page="/sfc.mrqa?action=view">返回</html:link>
                    </logic:notPresent>&nbsp;&nbsp;&nbsp;&nbsp;
                    <html:submit value="修改"/>&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="button" name="addBtn" value="增加子分类" onclick="addCat(this.form)"/>&nbsp;&nbsp;&nbsp;&nbsp;
                    <bean:size id="catssize" name="sfclist"/>
                    <logic:lessThan value="1" name="catssize">
                        <html:submit value="删除" onclick="delCat(this.form)"/>
                    </logic:lessThan>
                </td>
            </tr>
        </tbody>
        </html:form>
    </table>
    子分类
    <display:table name="sfc.mrIaskSharedFileCategories" class="its" id="sfc1">
        <display:column property="id" title="ID" />
        <display:column property="name" title="名称" />
        <display:column property="level" title="层级" />
        <display:column property="priority" title="优先显示" />
        <display:column title="操作">
            <html:link page="/sfc.mrqa?action=view" paramId="id" paramName="sfc1" paramProperty="id">修改</html:link>
        </display:column>
    </display:table>
</logic:present>
<logic:notPresent name="sfc">
    <display:table name="sfclist" class="its" id="sfc1">
        <display:column property="id" title="ID" />
        <display:column property="name" title="名称" />
        <display:column property="level" title="层级" />
        <display:column property="priority" title="优先显示" />
        <display:column title="操作">
            <html:link page="/sfc.mrqa?action=view" paramId="id" paramName="sfc1" paramProperty="id">修改</html:link>
        </display:column>
    </display:table>
    <input type="button" name="addBtn" value="增加子分类" onclick="addCat(this)"/>
</logic:notPresent>
<script type="text/javascript">
    var contextPath = "<%=request.getContextPath()%>";
    function addCat(pButton)
    {
        var url = contextPath+"/sfc.mrqa?action=preadd&parentId=<c:out value="${sfc.id}"/>";        
        document.location.href = url;
    }        
    function delCat(pForm)
    {
        pForm.action.value = "delete";
    }
</script>
说明：删除共享资料分类前，保证此分类下的共享资料全部被删除完毕。
<c:if test="${param.id != null}">
    <br><span class="title1">共享资料</span>
    <display:table name="sfs" class="mars" id="sf" cellpadding="1" cellspacing="1">
            <display:column title="ID">
                <c:out value="${sf.id}"/>
            </display:column>
            <display:column title="名称">
                <html:link page="/sf.mrqa?action=get" paramId="id" paramName="sf" paramProperty="id">
                    <c:out value="${sf.name}"/>
                </html:link>
            </display:column>
            <display:column property="postDate" title="日期" format="{0,date,yyyy-MM-dd HH:mm}"/>
            <display:column title="作者">
                <c:set var="user_id" value="${sf.mrIaskUser.id}"/>
                <html:link page="/user.mrqa?action=viewuserbyother" styleId="author" paramId="id" paramName="user_id">
                   <c:out value="${sf.mrIaskUser.loginName}"/>
                </html:link>                
            </display:column>
            <display:column title="操作">
                        <c:if test="${sf.state == '1'}">
                            <html:link page="/sf.mrqa?action=hide" paramId="id" paramName="sf" paramProperty="id">取消隐藏</html:link>
                            &nbsp;&nbsp;
                        </c:if>
                        <html:link page="/sf.mrqa?action=delete" paramId="id"  paramName="sf" paramProperty="id" title="删除后不能恢复">删除</html:link>
            </display:column>
    </display:table>
</c:if>
<qautil:page action="/sfc.mrqa"/>

